package com.mye.prometheusexportdcim.dto.query.component.add;

public enum SnmpEncryptionWayEnum {

    /**
     * 加密方式
     */
    ENCRYPTION_WAY_1(1,"Priv3DES"),
    ENCRYPTION_WAY_3(3,"PrivAES128"),
    ENCRYPTION_WAY_4(4,"PrivAES192"),
    ENCRYPTION_WAY_5(5,"PrivAES192With3DESKeyExtension"),
    ENCRYPTION_WAY_6(6,"PrivAES256"),
    ENCRYPTION_WAY_7(7,"PrivAES256With3DESKeyExtension"),
    ENCRYPTION_WAY_9(9,"PrivDES");

    private final String value;
    private final int key;

    public int getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    SnmpEncryptionWayEnum(int key, String value) {
        this.key = key;
        this.value = value;
    }

    /**
     * 判断数值是否属于枚举类的值
     *
     * @param value
     * @return
     */
    public static boolean isInclude(String value) {
        boolean include = false;
        for (SnmpEncryptionWayEnum e : SnmpEncryptionWayEnum.values()) {
            if (value.equals(e.value)) {
                include = true;
                break;
            }
        }
        return include;
    }

    /**
     * 判断key是否属于枚举类的值
     * @param key
     * @return
     */
    public static boolean isInclude2(int key) {
        boolean include = false;
        for (SnmpEncryptionWayEnum e : SnmpEncryptionWayEnum.values()) {
            if (key == e.key) {
                include = true;
                break;
            }
        }
        return include;
    }


    public static String getValue(int key) {
        String value = "";
        for (SnmpEncryptionWayEnum e : SnmpEncryptionWayEnum.values()) {
            if (e.key == key) {
                value = e.getValue();
                break;
            }
        }
        return value;
    }
    public static int getKey(String value) {
        int  key = 0;
        for (SnmpEncryptionWayEnum e : SnmpEncryptionWayEnum.values()) {
            if (e.value.equals(value)) {
                key = e.getKey();
                break;
            }
        }
        return key;
    }
}
